﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HZ.MBSM.DBUtility;
using System.Drawing;
public partial class Supervise_GoodsUpdat : System.Web.UI.Page
{
    string goodsid;
    public string strSql, status, iszx = "none";
    Int64 Accountid_QY;

    protected void Page_Load(object sender, EventArgs e)
    {

        System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> _AccountType = new System.Collections.Generic.List<HZ.MBSM.DAL.AccountType>();
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumSupervise); 
        if (HZ.MBSM.BLL.Login.CheckAssert(_AccountType))
        {
            goodsid = SysFun.IsSQL(Request.QueryString["GoodsId"].ToString());
            if (!IsPostBack)
            {

                //string goodscount;
                HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];
                if (_Account != null)
                {
                     
                    Accountid_QY = SysFun.ToLong(_Account.AccountId);

                    string ComName = "";
                    Db db = new Db();
                    System.Data.IDataReader dr;
                    //取得商品信息
                    strSql = @" select productname_gjsp,Medicinemodel_gjsp,Outlookc_gjsp,Unit_gjsp lastyearPayDuty,memo1, companyRegistermeney,PriceonlyDJ,ispPerformcountryprice,PriceliscensePW, dbo.Chk_GetCompanyName(AccountId_SC) as companyname_sc,AccountId_SC,AccountId_TJR, GoodsId, ProductId, GoodsName,  LicenseNumber, LicenseNumberDate, IsSurveyReport, SurveyReportId, SurveyReportDate,   ImportCode, ImportRegistDate, IsPrimitive, Pack, RetailPrice, CheckStatus, IsImport, Factor, PackUnit, Licence, LicenceDate, AccountId_SC, GoodsInstruction,  Material,  NoPass,  ImgUrl, memo4, memo5, shenhetime, IsDel, sh_discrible, ProductNameSM, AccountName_SHR, AccountName_TJR,   ischange,  QualitylevelsStandard, Qualitylevelstrustiness, QualitylevelsManage , ProductName,Medicinemodel,Outlookc,Unit from v_product_goods where goodsid='" + goodsid + "'";
                    dr = db.DataReader(strSql);
                    while (dr.Read())
                    {
                        Hpid.Value = dr["productid"].ToString();
                        labProductCode.Text = dr["productid"].ToString();
                        HAccountId_TJR.Value = dr["AccountId_TJR"].ToString();
                        HAccountId_TJname.Value = dr["AccountName_TJR"].ToString();
                        labProductName.Text = SysFun.ToTrim(dr["productname"].ToString());//商品通用名

                        string _strMedicinemodel = dr["Medicinemodel"].ToString();
                        string _strOutlookc = dr["Outlookc"].ToString();
                        labMedicinemodel.Text = _strMedicinemodel;
                        labOutlookc.Text = _strOutlookc;
                        labunit.Text = dr["Unit"].ToString();
                        labprice.Text = SysFun.ToTrim(dr["memo1"]);

                        txtCompany.Text = dr["companyname_sc"].ToString();//生产企业名称
                        txtIsSalerId.Value = dr["AccountId_SC"].ToString();

                        status = "none";//默认不显示

                        if (dr["ispPerformcountryprice"].ToString() != "" && Convert.ToBoolean(dr["ispPerformcountryprice"]))//是否不执行国家价格
                        {
                            chkIsImport.Checked = true;
                            TextWJPW.Text = dr["PriceliscensePW"].ToString();
                            iszx = "block";
                            txtPriceonlyDJ.Text = dr["PriceonlyDJ"].ToString();
                        }


                        labunit.Text = SysFun.ToTrim(dr["Unit_gjsp"].ToString());

                        /********* goods部分********/
                        txtProductNameSM.Text = dr["ProductNameSM"].ToString();
                        txtFactor.Text = dr["factor"].ToString();
                        txtLicenseNumber.Text = dr["LicenseNumber"].ToString();
                        if (dr["LicenseNumberDate"] != "" && !dr["LicenseNumberDate"].ToString().Equals("1900-1-1 0:00:00"))
                        {
                            txtLicenseNumberDate.Text = dr["LicenseNumberDate"].ToString();
                        }
                        txtGoodsName.Text = dr["goodsname"].ToString();
                        txtMaterial.Text = dr["Material"].ToString();
                        if (dr["IsSurveyReport"].ToString() != "")
                        {
                            chkIsSurveyReport.Checked = Convert.ToBoolean(dr["IsSurveyReport"].ToString());
                        }
                        else
                        {
                            chkIsSurveyReport.Checked = false;
                        }
                        txtSurveyReportId.Text = dr["SurveyReportId"].ToString();
                        if (dr["SurveyReportDate"] != null && !dr["SurveyReportDate"].ToString().Equals("1900-1-1 0:00:00"))
                        {
                            txtSurveyReportDate.Text = dr["SurveyReportDate"].ToString();
                        }
                        txtFactor0.Text = dr["lastyearPayDuty"].ToString().Trim();
                        txtFactor1.Text = dr["companyRegistermeney"].ToString().Trim();
                        rdoQualitylevelsStandard.SelectedIndex = Convert.ToInt32(dr["QualitylevelsStandard"].ToString());
                        rdoQualitylevelstrustiness.SelectedIndex = Convert.ToInt32(dr["Qualitylevelstrustiness"].ToString());
                        RadioQualitylevelsManage.SelectedIndex = Convert.ToInt32(dr["QualitylevelsManage"].ToString());
                        txtGoodsInstruction.Text = dr["GoodsInstruction"].ToString();
                        txtproduct.Text = dr["productname_gjsp"].ToString();
                        txtmedici.Text = dr["Medicinemodel_gjsp"].ToString();
                        txtoutlookc.Text = dr["Outlookc_gjsp"].ToString();
                        txtunit.Text = dr["Unit_gjsp"].ToString();

                    }
                    db.Close();
                    dr.Close();
                    dr.Dispose();

                }
            }
        }
    }
 
    //获取审核不 通过原因
    private string GetNOpss()
    {
        System.Text.StringBuilder strnopass = new System.Text.StringBuilder();
        if (CheckBox1.Checked == true)
        {
            strnopass.Append("缺失注册批件 ！\n");
        }
        if (CheckBox2.Checked == true)
        {
            strnopass.Append("批准文号已过期！\n");
        }
        if (CheckZhiLiangCX.Checked == true)
        {
            strnopass.Append("缺失物价证明文件 ！\n");
        }
        if (CheckYaoPinJYBG.Checked == true)
        {
            strnopass.Append("物价证明文件已过期！\n");
        }
        if (CheckYaoPinYXQ.Checked == true)
        {
            strnopass.Append("缺失质量层次证明文件 ！\n");
        }
        if (CheckBox3.Checked == true)
        {
            strnopass.Append("缺失商品说明书！\n");
        }

        if (CheckBox4.Checked == true)
        {
            strnopass.Append("缺失检验报告单 ！\n ");
        }

        if (CheckBox6.Checked == true)
        {
            strnopass.Append("检验报告已过期 ！\n ");
        }
        if (CheckBoxNotall.Checked == true)
        {
            strnopass.Append("商品资料不全，请按“内部信息”栏目所列《资质预审资料要求》将商品资料装订成册，速递交至中心企管部！\n");
        }

        if (CheckJYBG.Checked == true)
        {
            strnopass.Append("需提交09年最新检验报告！\n");
        }
        if (Checkwjd.Checked == true)
        {
            strnopass.Append("需提交云南省物价单！\n");
        }
        if (CheckBoxRegister.Checked == true)
        {
            strnopass.Append("需提交注册批件或注册证！\n");
        }

        strnopass.Append(TxtNopass.Text.Trim());
        return strnopass.ToString();
    }

    
}

